package cn.knowimage.jsonmake;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

public class Test1 {
    public static JSONObject prep_treatment_common(String prep_treatment_common_num, String prep_treatment_common_time_unit,
    String prep_treatment_common_min, String prep_treatment_common_max,String prep_obligatory_exam_num,
    String prep_optional_exam_num,String prep_notification_num,String prep_obligatory_exam,String prep_optional_exam,
     String prep_notification){
        JSONObject prep_treatment_common = new JSONObject();
        JSONArray prep_treatment_common_time_unit_s = JSONArray.fromObject(prep_treatment_common_time_unit);
        JSONArray prep_treatment_common_min_s = JSONArray.fromObject(prep_treatment_common_min);
        JSONArray prep_treatment_common_max_s = JSONArray.fromObject(prep_treatment_common_max);
        JSONArray prep_obligatory_exam_num_s = JSONArray.fromObject(prep_obligatory_exam_num);
        JSONArray prep_optional_exam_num_s = JSONArray.fromObject(prep_optional_exam_num);
        JSONArray prep_notification_num_s = JSONArray.fromObject(prep_notification_num);
        JSONArray prep_obligatory_exam_s = JSONArray.fromObject(prep_obligatory_exam);
        JSONArray prep_optional_exam_s = JSONArray.fromObject(prep_optional_exam);
        JSONArray prep_notification_s = JSONArray.fromObject(prep_notification);

        int num;
        if (prep_treatment_common_num==null||"".equals(prep_treatment_common_num)){
            num = 0;
        }else{
            num = Integer.parseInt(prep_treatment_common_num);
        }//判断

        JSONObject scenario = new JSONObject();
        scenario.put("num",prep_treatment_common_num);
        //未完待续，根据Prep_Treatment_CommonJson

        /*JSONArray treatment_choice_num_s = JSONArray.fromObject(treatment_choice_num);
        JSONArray treatment_choice_num_id_s = JSONArray.fromObject(treatment_choice_num_id);
        int num;
        if (treatment_choice_scenario==null||"".equals(treatment_choice_scenario)){
            num = 0;
        }else{
            num = Integer.parseInt(treatment_choice_scenario);
        }

        scenario.put("num",num);
        int count = 0;
        for (int i = 0;i<num;i++){
            JSONArray id_ = new JSONArray();
            if (treatment_choice_num_s.get(i)==null||"".equals(treatment_choice_num_s.get(i))){

            }else {
                for (int j = 0;j<Integer.parseInt(treatment_choice_num_s.getString(i));j++){
                    id_.add(treatment_choice_num_id_s.getString(count));
                }
            }
            scenario.put(String.format("id_%d",i),id_);
        }
        treatment_choice.put("scenario",scenario);
        System.out.println(treatment_choice.toString());
        return treatment_choice;
    }*/
        return prep_treatment_common;
}}
